using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
namespace MicroMsg.UI.UserContrl
{
	public class ContactGroupItem : UserControl
	{
		public static DependencyProperty mStrKeyProperty = DependencyProperty.Register("mStrKey", typeof(string), typeof(ContactGroupItem), new PropertyMetadata(null, new PropertyChangedCallback(ContactGroupItem.OnmStrKeyPropertyChanged)));
		internal TextBlock txtContent;
		private bool _contentLoaded;
		public event MMStandardUIEvent ItemClick;
		public string mStrKey
		{
			get
			{
				return (string)base.GetValue(ContactGroupItem.mStrKeyProperty);
			}
			set
			{
				base.SetValue(ContactGroupItem.mStrKeyProperty, value);
			}
		}
		private static void OnmStrKeyPropertyChanged(DependencyObject dependencyObject_0, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs_0)
		{
			if (dependencyPropertyChangedEventArgs_0.get_Property() == ContactGroupItem.mStrKeyProperty)
			{
				(dependencyObject_0 as ContactGroupItem).mStrKeyPropertyChanged(dependencyPropertyChangedEventArgs_0);
			}
		}
		private void mStrKeyPropertyChanged(DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs_0)
		{
			if (dependencyPropertyChangedEventArgs_0.get_OldValue() != dependencyPropertyChangedEventArgs_0.get_NewValue())
			{
				if (string.IsNullOrEmpty(this.mStrKey))
				{
					base.set_Visibility(1);
					return;
				}
				char c = this.mStrKey.get_Chars(0);
				if (c != '*')
				{
					if (c != '&')
					{
						if (c < '\u0001' || c > '\u0013')
						{
							this.txtContent.set_FontSize(48.0);
							this.txtContent.set_Text(this.mStrKey);
							base.set_Visibility(0);
							return;
						}
						if (ContactsView.GetGroupDisplayStyle() == ContactsGroupStyle.ByStroke)
						{
							this.txtContent.set_Text((int)c + "劃");
							this.txtContent.set_FontSize(36.0);
							base.set_Visibility(0);
							return;
						}
						base.set_Visibility(1);
						return;
					}
				}
				base.set_Visibility(1);
				return;
			}
		}
		public ContactGroupItem()
		{
			this.InitializeComponent();
		}
		private void Border_Tap(object sender, GestureEventArgs e)
		{
			if (this.ItemClick != null)
			{
				this.ItemClick(this, this.mStrKey);
			}
		}
		[DebuggerNonUserCode]
		public void InitializeComponent()
		{
			if (this._contentLoaded)
			{
				return;
			}
			this._contentLoaded = true;
			Application.LoadComponent(this, new Uri("/MicroMsg;component/Source/UI/Contact/ContactGroupItem.xaml", 2));
			this.txtContent = (TextBlock)base.FindName("txtContent");
		}
	}
}
